<template>
    <div class="bg">
        <div class="top">
            <div class="topw">我的关注</div>
            <div class="topd">
            </div>
        </div>
        <!--        没有数据-->
        <div>
            <el-table
                    :data="tableData"
                    :show-header=false
                    style="width: 100%">
                <el-table-column
                        prop="avatar"
                        align="center"
                        width="100px"
                >
                    <template slot-scope="scope">
                        <img :src="scope.row.avatar" height="50px">
                    </template>
                </el-table-column>
                <el-table-column
                        prop="name"
                        align="center"
                >
                    <template slot-scope="scope">
                        <span  style="color:gray;">{{scope.row.name}}</span>
                    </template>
                </el-table-column>
                <el-table-column
                        width="250px"
                >
                    <template slot-scope="scope">
                        <el-button
                                size="mini"
                                type="primary"
                                @click="toZhuye">进入主页</el-button>
                        <el-button
                                size="mini"
                                type="danger"
                                @click="quguan(scope.row.id)">取消关注</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>

<script>
    export default {
        name: "follow",
        data(){
            return{
                tableData:[],
            }
        },
        created() {
            this.init();
        },
        methods:{
            init(){
                var that=this;
                this.$http.post(`core/follow/findFollowsByMemberId`).then(function (resp) {
                    if (resp.data.code===2000){
                        that.tableData=resp.data.result;
                    }
                })
            },
            toZhuye(){
                this.$router.push({name:'home'});
            },
            quguan(id){
                var that=this;
                this.$http.post(`core/follow/deleteFollow/${id}`).then(function (resp) {
                    if (resp.data.code===2000){
                        that.$message.success(resp.data.msg);
                        that.init();
                    }else {
                        that.$message.error(resp.data.msg);
                    }
                })
            },
        }
    }
</script>

<style scoped>

</style>